package com.zhijian.warehouse.manage.exception;

import com.zhijian.warehouse.manage.enums.ResponseEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * 异常基类
 *
 * @Author hcg
 * @DateTime 2019年4月14日 下午2:28:22
 * @Version 1.0.1
 */
@Getter
@Setter
public class BusinessCommonException extends RuntimeException {
    private static final long serialVersionUID = 4432093981021295447L;

    private int exCode;
    private String exCnMsg;
    private String exEnMsg;
    private String exInfo;

    public BusinessCommonException(ResponseEnum statusEnum) {
        this(statusEnum.code, statusEnum.cn, statusEnum.en, null);
    }

    public BusinessCommonException(ResponseEnum statusEnum, String exInfo) {
        this(statusEnum.code, statusEnum.cn, statusEnum.en, exInfo);
    }

    public BusinessCommonException(int exCode, String exCnMsg) {
        this(exCode, exCnMsg, null, null);
    }

    public BusinessCommonException(int exCode, String exCnMsg, String exEnMsg, String exInfo) {
        super(exCnMsg);
        this.exCode = exCode;
        this.exCnMsg = exCnMsg;
        this.exEnMsg = exEnMsg;
        this.exInfo = exInfo;
    }
}
